package com.hae.shop.wechat.api;

import com.hae.shop.common.base.Response;
import com.hae.shop.wechat.model.respDto.AppInfoRespDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;


@Api
public interface WechatService {

    @ApiOperation(value = "获取微信应用服务信息接口")
    @GetMapping("/getApp")
    Response<AppInfoRespDto> getApp();


    @ApiOperation(value = "微信验证码正确性验证接口")
    @PostMapping("/varifyCode")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "mobile", value = "手机号码", type = "String", required = true),
            @ApiImplicitParam(paramType = "query", name = "code", value = "验证码", type = "String", required = true)
    })
    Response<Boolean> verifyCode(@RequestParam("mobile")
                                 @Size(min = 11, max = 11, message = "手机长度11位！")
                                 @NotBlank(message = "手机号不能为空！") String mobile,
                                 @RequestParam("code")
                                 @Min(1)
                                 @NotBlank(message = "code不能为空！") String code);

}
